﻿package com.PlantVsZombies.game;

import java.awt.Button;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.text.StyledEditorKit.BoldAction;

import com.PlantVsZombies.util.MusicPlay;
import com.PlantVsZombies.util.MusicUtil;

public class Welcome extends JPanel {
	private static BufferedImage guanyu;
	private static BufferedImage Logo_1;
	private static BufferedImage image;
	private static BufferedImage Logo1;
	private static BufferedImage Logo2;
	private static BufferedImage welcome_1;
	private static ImageIcon logo_1_2;
	private static BufferedImage image1;
	private static BufferedImage image2;
	private static ImageIcon Blover;
	private static BufferedImage logo_1_1;
	private static BufferedImage logo_1_1_2;
	private static ImageIcon bengji;
	private static ImageIcon welcom_gif;
	public static Color color = Color.BLACK;
	public static Color color1 = Color.WHITE;
	public static Boolean  flag0= false;
	WelcomeListner wl = new WelcomeListner();
	static {
		try {
			guanyu = ImageIO.read(new FileInputStream("images/login/guanyu.png"));
			Logo_1 = ImageIO.read(new FileInputStream("images/login/Logo_1.png"));
			welcome_1 = ImageIO.read(new FileInputStream("images/login/welcom2.jpg"));
			Blover = new ImageIcon("images/login/Blover.gif");
			bengji = new ImageIcon("images/login/bengji.gif");
			welcom_gif = new ImageIcon("images/login/welcom2.gif");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public void paint(Graphics g) {
		super.paint(g);
		g.setFont(new Font("宋体", Font.BOLD, 30));
		g.setColor(color);
		g.drawImage(welcome_1, 0, 0, null);
		g.drawString("开始游戏！", 286, 362);
		g.setFont(new Font("宋体", Font.BOLD, 30));
		g.setColor(color1);
		g.drawString("制作", 680, 475);
		if(flag0)
			g.drawImage(guanyu, 200, 100, null);
		repaint();
	}
	public static MusicPlay welcome;
	public Welcome() {
		this.addMouseListener(wl);
		image1 = Logo1;
		image2 = logo_1_1;
		this.addMouseMotionListener(wl);
		welcome = new MusicPlay(MusicUtil.WELCOME);
		welcome.loop();

	}

}
